<template>
  <div>
    <i class="el-icon-full-screen screenfull-svg" @click="click"></i>
  </div>
</template>
 
<script>
import screenfull from "screenfull";

export default {
  name: "Screenfull",
  data() {
    return {
      isFullscreen: false,
    };
  },
  mounted() {
    this.init();
  },
  beforeDestroy() {
    this.destroy();
  },
  methods: {
    click() {
      screenfull.toggle();
    },
    change() {
      this.isFullscreen = screenfull.isFullscreen;
    },
    init() {
      if (screenfull.enabled) {
        screenfull.on("change", this.change);
      }
    },
    destroy() {
      if (screenfull.enabled) {
        screenfull.off("change", this.change);
      }
    },
  },
};
</script>
 
<style scoped>
.screenfull-svg {
  display: inline-block;
  cursor: pointer;
  color: #2c2c2c;
  color: #000;
  width: 20px;
  height: 20px;
  vertical-align: 10px;
  font-size: 20px;
  /* margin-right: 10px; */
  /* color: #fff; */
}
</style> 